package main

import (
	"code.google.com/p/goplan9/plan9/acme"
	"flag"
	"fmt"
	"log"
	"strconv"
)

func main() {
	flag.Parse()

	if flag.NArg() != 1 {
		log.Fatal("winid not specified")
	}

	winid, err := strconv.Atoi(flag.Args()[0])
	if err != nil {
		log.Fatal(err)
	}

	win, err := acme.Open(winid, nil)
	if err != nil {
		log.Fatal(err)
	}

	win.ReadAddr()
	win.Ctl("addr=dot")
	q0, q1, err := win.ReadAddr()
	if err != nil {
		log.Fatal(err)
	}

	if q0 == q1 {
		fmt.Printf("#%d\n", q0)
	} else {
		fmt.Printf("#%d,#%d\n", q0, q1)
	}
}
